package io.lkt.modules.sys.controller;

import io.lkt.common.util.Query;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.R;
import io.lkt.modules.sys.entity.BUserInviteIncomeInfoEntity;
import io.lkt.modules.sys.entity.BUserPunchClockInfoEntity;
import io.lkt.modules.sys.service.BUserInviteIncomeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * 用户邀请收入信息表
 */
@RestController
@RequestMapping("/sys/buserinviteincomeinfo")
public class BUserInviteIncomeInfoController {
    @Autowired
    private BUserInviteIncomeInfoService bUserInviteIncomeInfoService;

    /**
     * 信息
     */
    @RequestMapping("/info")
    public R info(@RequestParam Map<String, Object> params){
        if (params.get("userId") == null) {
            return R.error("用户不存在");
        }
        Query query = new Query(params);
        List<BUserInviteIncomeInfoEntity> list = bUserInviteIncomeInfoService.getInfoByUserId(query);
        int total = bUserInviteIncomeInfoService.getInfoByUserIdTotal(query).intValue();
        PageUtils page = new PageUtils(list, total, query.getLimit(), query.getPage());
        return R.ok().put("page", page);
    }

}
